<?php
define('INWEB', True);
chdir('..');
require_once("include/config.php");
//пароль
if(isset($_GET['pol_nr']) && $_GET['pol_nr']!='' && isset($_GET['pol_add_nr']) && $_GET['pol_add_nr']!=''  && $user->logged())
{
	$pol_nr=getVar('pol_nr');
    $pol_add_nr=getVar('pol_add_nr');
   	$checkquery=$sql->query("SELECT id FROM policies WHERE `nr`='$pol_nr' AND `add_nr`='$pol_add_nr';");
   	if($sql->num_rows($checkquery))
   	{
        echo "alert('Policy witch that number and additional number already exists');\ngetEle('pol_nr').value=null;\ngetEle('pol_add_nr').value=null;\ngetEle('pol_nr').focus();\ngetEle('ins_type').selectedIndex=0;\n";	
   	}
}
else if(isset($_GET['pol_nr']) && $_GET['pol_nr']!='' && $user->logged())
{
    $pol_nr=getVar('pol_nr');
   	$checkquery=$sql->query("SELECT id FROM policies WHERE `nr`='$pol_nr';");
   	if($sql->num_rows($checkquery))
   	{
        echo "alert('Policy witch that number already exists');\ngetEle('pol_nr').value=null;\ngetEle('pol_nr').focus();\ngetEle('ins_type').selectedIndex=0";	
   	}
}
else
{
    echo "alert('Something went wrong');";
	die('Missing vars or not logged');
}
?>